﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

namespace TCC.Framework
{
    /// <summary>
    /// 全局工具类函数
    /// </summary>
    public static class GlobalFunction
    {
        /// <summary>
        /// 当前鼠标是否停留在UGUI控件上
        /// </summary>
        /// <returns>是否</returns>
        public static bool IsPointerOverUGUI()
        {
            if (EventSystem.current)
            {
#if UNITY_ANDROID && !UNITY_EDITOR
                if (Input.touchCount > 0)
                {
                    return EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId);
                }
                else
                {
                    return false;
                }
#else
                return EventSystem.current.IsPointerOverGameObject();
#endif
            }
            else
            {
                return false;
            }
        }
    }
}

